import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:get/get_navigation/src/root/get_material_app.dart';
import 'package:scanner/page_routes.dart';
import 'package:scanner/tools/wj_preferences.dart';

import 'config/ar_themes.dart';
import 'main/init/wj_init_binding.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await WJSpTool.init();

  SystemChrome.setPreferredOrientations([
    DeviceOrientation.portraitUp, // 固定为竖屏
  ]);
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return ScreenUtilInit(
      designSize: const Size(375, 812),
      minTextAdapt: true,
      splitScreenMode: true,
      builder: (BuildContext context, Widget? child) {
        return GetMaterialApp(
          getPages: WJAppRoutes.routes,
          debugShowCheckedModeBanner: false,
          initialBinding: WJInitBinding(),
          initialRoute: WJAppRoutes.appSplash,
          theme: WJThemes.normal,
          themeMode: ThemeMode.dark,
          title: "超级扫描王",
          builder: EasyLoading.init(),
          routingCallback: (routing) {


          },

        );
      },
    );
  }
}
